﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.X.Rabbit.Read.Api.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 
        /// </summary>
        public delegate void TestDelegate();
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult Test()
        {
            //string aa = "3225";
            //TestDelegate testDelegate = Test2;
            //testDelegate();

            //Action("abc", Test2);
            List<Account> list = new List<Account>();

            list.Add(new Account() { AccountName = "zhangsan", Age = 18 });
            list.Add(new Account() { AccountName = "lisi", Age = 20 });
            list.Add(new Account() { AccountName = "wangwu", Age = 22 });
            list.Add(new Account() { AccountName = "zhaoliu", Age = 24 });
            list.Add(new Account() { AccountName = "sunqi", Age = 26 });
            list.Add(new Account() { AccountName = "liuyuan", Age = 28 });

            Func<Account, bool> func = x => { return x.AccountName == "zhangsan"; };

            var result = list.Where(x => x.AccountName == "zhangsan");
            var result1 = list.Where(func);

            return Ok();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="a"></param>
        /// <param name="test"></param>
        [HttpGet]
        public void Action(string a, TestDelegate test)
        {
            test();                 
        }


        /// <summary>
        /// 
        /// </summary>
        [HttpGet]
        public void Test2()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        [HttpGet]
        public void Test4()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="i"></param>
        [HttpGet]
        public void Test3(int i)
        {

        }
    }
    /// <summary>
    /// 
    /// </summary>
    public class Account()
    {
        public string AccountName { get; set; }

        public int Age { get; set; }
    }
}
